package com.dome.testgallery.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;

public class GalleryIndexAdapter extends BaseAdapter{
	private List<Integer> imagList;
	private Context context;
	
	public GalleryIndexAdapter(List<Integer> list,Context cx) {
		this.imagList = list;
		this.context = cx;
	}
	
	@Override
	public int getCount() {
		return Integer.MAX_VALUE;
	}

	@Override
	public Object getItem(int arg0) {
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		
		ImageView imageView = new ImageView(context);
		imageView.setBackgroundResource(imagList.get(position%imagList.size()));
		imageView.setScaleType(ScaleType.FIT_XY);
		imageView.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.FILL_PARENT
				, Gallery.LayoutParams.WRAP_CONTENT));
		return imageView;
	}

}
